package com.devops.utils.error;

import com.devops.entity.resp.ErrorReason;
import lombok.Data;

import java.util.ArrayList;
import java.util.List;

@Data
public class ReturnErrorException extends Exception{

    private ResultType resultType;
    private List<ErrorReason> errorList;
    private String obj;
    private String reason;
    private int code;

    public ReturnErrorException(ResultType resultType, ErrorReason error) {
        super(resultType.getMsg());
        List<ErrorReason> errorReasonList = new ArrayList<>();
        errorReasonList.add(error);
        this.resultType = resultType;
        this.errorList = errorReasonList;
    }

    public ReturnErrorException(ResultType resultType, List<ErrorReason> errorList) {
        super(resultType.getMsg());
        this.resultType = resultType;
        this.errorList = errorList;
    }

    public ReturnErrorException(ResultType resultType, List<ErrorReason> errorList, String obj, String reason, int code) {
        super(resultType.getMsg());
        this.resultType = resultType;
        this.errorList = errorList;
        this.obj = obj;
        this.reason = reason;
        this.code = code;
    }

}
